#ifndef OOP_MUTEX_H
#define OOP_MUTEX_H
#include <Windows.h>
#include "OOPUtilsGlobal.hpp"
#include "OOPObject.h"

_OOPUTILS_BEGIN

class _EXPORT_UTILS_CLASS OOPMutex : public OOPObject
{
public:
	class ScopedLock {
	public:
		ScopedLock (OOPMutex &mutex);
		~ScopedLock ();
	private:
		OOPMutex &_mutex;
	};

	OOPMutex (bool lockOnCreate = false);
	~OOPMutex ();

	void lock (DWORD waitTime = INFINITE);
	void unlock ();

private:
	HANDLE _hMutex;
};

_OOPUTILS_END

#endif